<template>
  <div class="h5-system">
    <div class="system-card">
      <div class="card-header" @click="isShow = !isShow">
        <span class="title">系统信息</span>
        <el-icon class="arrow-icon" :class="{ 'expanded': isShow }">
          <ArrowDown />
        </el-icon>
      </div>
      
      <el-collapse-transition>
        <div v-show="isShow" class="system-content">
          <!-- 负责人 -->
          <div class="system-item">
            <span class="label">负责人</span>
            <span class="value">{{ CustomerValue.ownerUserName || '-' }}</span>
          </div>
          
          <!-- 创建人 -->
          <div class="system-item">
            <span class="label">创建人</span>
            <span class="value">{{ CustomerValue.creatorName || '-' }}</span>
          </div>
          
          <!-- 最后跟进时间 -->
          <div class="system-item">
            <span class="label">最后跟进时间</span>
            <span class="value">{{ formatDate(CustomerValue.contactLastTime) || '-' }}</span>
          </div>
          
          <!-- 最后跟进记录 -->
          <div class="system-item">
            <span class="label">最后跟进记录</span>
            <span class="value">{{ CustomerValue.contactLastContent || '-' }}</span>
          </div>
          
          <!-- 创建时间 -->
          <div class="system-item">
            <span class="label">创建时间</span>
            <span class="value">{{ formatDate(CustomerValue.createTime) || '-' }}</span>
          </div>
          
          <!-- 更新时间 -->
          <div class="system-item">
            <span class="label">更新时间</span>
            <span class="value">{{ formatDate(CustomerValue.updateTime) || '-' }}</span>
          </div>
        </div>
      </el-collapse-transition>
    </div>
  </div>
</template>

<script setup>
import { formatDate } from '@/utils/formatTime'
import { ArrowDown } from '@element-plus/icons-vue'

const isShow = ref(true)

const props = defineProps({
  CustomerValue: Object
})
</script>

<style lang="scss" scoped>
.h5-system {
  margin-bottom: 8px;
  
  .system-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    
    .card-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px;
      background: #f8f9fa;
      cursor: pointer;
      border-bottom: 1px solid #ebeef5;
      
      .title {
        font-size: 16px;
        font-weight: 500;
        color: #303133;
      }
      
      .arrow-icon {
        transition: transform 0.3s;
        color: #909399;
        
        &.expanded {
          transform: rotate(180deg);
        }
      }
    }
    
    .system-content {
      padding: 0;
      
      .system-item {
        display: flex;
        align-items: flex-start;
        padding: 12px 16px;
        border-bottom: 1px solid #f0f0f0;
        
        &:last-child {
          border-bottom: none;
        }
        
        .label {
          flex-shrink: 0;
          width: 100px;
          color: #909399;
          font-size: 14px;
          line-height: 1.5;
        }
        
        .value {
          flex: 1;
          color: #303133;
          font-size: 14px;
          line-height: 1.5;
          word-break: break-all;
        }
      }
    }
  }
}
</style>